import { createRouter, createWebHashHistory } from 'vue-router'
import Admin from '@/views/Admin.vue'
import Map from '@/views/Map.vue'
import Dispatcher from '@/views/Dispatcher.vue'
import ClubMain from '@/views/ClubMain.vue'
import Login from '@/views/Login.vue'

import PlaneTrain from '@/views/planfly/PlaneTrain.vue'
import PlaneExperince from '@/views/planfly/PlaneExperince.vue'
import PlaneSkydiving from '@/views/planfly/PlaneSkydiving.vue'
import PlaneCharter from '@/views/planfly/PlaneCharter.vue'
import PlaneHosted from '@/views/planeService/PlaneHosted.vue'
import PlaneRent from '@/views/planeService/PlaneRent.vue'
import MyInfo from '@/views/my/MyInfo.vue'
import MyAppoint from '@/views/my/MyAppoint.vue'
import MyOrder from '@/views/my/MyOrder.vue'
import MyMessage from '@/views/my/MyMessage.vue'
import Dispatch from '@/views/my/Dispatch.vue'
import MyStudent from '@/views/my/MyStudent.vue'



import AdminUser from '@/views/admin/AdminUser.vue'
import AdminPlane from '@/views/admin/AdminPlane.vue'
import AdminPlaneType from '@/views/admin/AdminPlaneType.vue'
import AdminPlaneTime from '@/views/admin/AdminPlaneTime.vue'
import Coach from '@/views/admin/Coach.vue'
import CoachTime from '@/views/admin/CoachTime.vue'
import Message from '@/views/admin/Message.vue'

const routes = [
  // 配置路由重定向
  {
    path: '/', // http://192.168.0.3:3033/
    redirect: '/main'
  },
  {
    path: '/admin',
    name: "admin",
    component: Admin,
    children:[
      {
        path:"adminUser",
        name:"adminUser",
        component:AdminUser
      },
      {
        path:"adminPlane",
        name:"adminPlane",
        component:AdminPlane
      },
      {
        path:"adminPlaneType",
        name:"adminPlaneType",
        component:AdminPlaneType
      },
      {
        path:"adminPlaneTime",
        name:"adminPlaneTime",
        component:AdminPlaneTime
      },
      {
        path:"coach",
        name:"coach",
        component:Coach
      },
      {
        path:"coachTime",
        name:"coachTime",
        component:CoachTime
      },
      {
        path:"message",
        name:"message",
        component:Message
      },
    ]
  },
  {
    path: '/map',
    name: "map",
    component: Map,
  },
  {
    path:'/dispatcher',
    name:'dispatcher',
    component: Dispatcher,
  },
  {
    path:'/main',
    name:'main',
    component:ClubMain,
    children:[
      {
        path:"planeTrain",
        name:"planeTrain",
        component:PlaneTrain
      },{
        path:"planeExperince",
        name:"planeExperince",
        component:PlaneExperince
      },{
        path:"planeSkydiving",
        name:"planeSkydiving",
        component:PlaneSkydiving
      },{
        path:"planeCharter",
        name:"planeCharter",
        component:PlaneCharter
      },{
        path:"planeHosted",
        name:"planeHosted",
        component:PlaneHosted
      },{
        path:"planeRent",
        name:"planeRent",
        component:PlaneRent
      },{
        path:"myInfo",
        name:"myInfo",
        component:MyInfo
      },{
        path:"myAppoint",
        name:"myAppoint",
        component:MyAppoint
      },{
        path:"myOrder",
        name:"myOrder",
        component:MyOrder
      },{
        path:"myMessage",
        name:"myMessage",
        component:MyMessage
      },{
        path:"dispatch",
        name:"dispatch",
        component:Dispatch
      },{
        path:"myStudent",
        name:"myStudent",
        component:MyStudent
      }
    ],
    redirect: "/main/planeTrain"
  },{
    path:"/login",
    name:"login",
    component:Login
  }
]

// 创建路由示例
const router = createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
  history: createWebHashHistory(),
  routes, // `routes: routes` 的缩写
})


export default router
